{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1、导入必要的工具包# "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from sklearn.metrics import *  #评价回归预测模型的性能\n",
    "import matplotlib.pyplot as plt   #画图\n",
    "import seaborn as sns\n",
    "import math\n",
    "\n",
    "\n",
    "# 图形出现在Notebook里而不是新窗口\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2.1、读取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>...</th>\n",
       "      <th>334</th>\n",
       "      <th>335</th>\n",
       "      <th>336</th>\n",
       "      <th>337</th>\n",
       "      <th>338</th>\n",
       "      <th>339</th>\n",
       "      <th>340</th>\n",
       "      <th>341</th>\n",
       "      <th>342</th>\n",
       "      <th>SalePrice</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.227483</td>\n",
       "      <td>-0.202770</td>\n",
       "      <td>0.064327</td>\n",
       "      <td>-0.243378</td>\n",
       "      <td>0.700717</td>\n",
       "      <td>0.026216</td>\n",
       "      <td>0.226042</td>\n",
       "      <td>1.253123</td>\n",
       "      <td>-0.419233</td>\n",
       "      <td>1.053769</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>208500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.670403</td>\n",
       "      <td>-0.086107</td>\n",
       "      <td>0.064327</td>\n",
       "      <td>-0.243378</td>\n",
       "      <td>0.700717</td>\n",
       "      <td>0.026216</td>\n",
       "      <td>0.226042</td>\n",
       "      <td>-0.694099</td>\n",
       "      <td>1.858393</td>\n",
       "      <td>0.159469</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>181500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.316067</td>\n",
       "      <td>0.081281</td>\n",
       "      <td>0.064327</td>\n",
       "      <td>-0.243378</td>\n",
       "      <td>-1.028509</td>\n",
       "      <td>0.026216</td>\n",
       "      <td>0.226042</td>\n",
       "      <td>1.253123</td>\n",
       "      <td>-0.419233</td>\n",
       "      <td>0.987524</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>223500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.079843</td>\n",
       "      <td>-0.091179</td>\n",
       "      <td>0.064327</td>\n",
       "      <td>-0.243378</td>\n",
       "      <td>-1.028509</td>\n",
       "      <td>0.026216</td>\n",
       "      <td>0.226042</td>\n",
       "      <td>1.253123</td>\n",
       "      <td>-0.419233</td>\n",
       "      <td>-1.860986</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>140000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.788515</td>\n",
       "      <td>0.386636</td>\n",
       "      <td>0.064327</td>\n",
       "      <td>-0.243378</td>\n",
       "      <td>-1.028509</td>\n",
       "      <td>0.026216</td>\n",
       "      <td>0.226042</td>\n",
       "      <td>1.253123</td>\n",
       "      <td>-0.419233</td>\n",
       "      <td>0.954402</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>250000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 344 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          0         1         2         3         4         5         6  \\\n",
       "0  0.227483 -0.202770  0.064327 -0.243378  0.700717  0.026216  0.226042   \n",
       "1  0.670403 -0.086107  0.064327 -0.243378  0.700717  0.026216  0.226042   \n",
       "2  0.316067  0.081281  0.064327 -0.243378 -1.028509  0.026216  0.226042   \n",
       "3  0.079843 -0.091179  0.064327 -0.243378 -1.028509  0.026216  0.226042   \n",
       "4  0.788515  0.386636  0.064327 -0.243378 -1.028509  0.026216  0.226042   \n",
       "\n",
       "          7         8         9    ...      334  335  336  337  338  339  340  \\\n",
       "0  1.253123 -0.419233  1.053769    ...        1    1    1    1    1    1    1   \n",
       "1 -0.694099  1.858393  0.159469    ...        1    1    1    1    1    1    1   \n",
       "2  1.253123 -0.419233  0.987524    ...        1    1    1    1    1    1    1   \n",
       "3  1.253123 -0.419233 -1.860986    ...        1    1    1    1    1    1    1   \n",
       "4  1.253123 -0.419233  0.954402    ...        1    1    1    1    1    1    1   \n",
       "\n",
       "   341  342  SalePrice  \n",
       "0    1    1     208500  \n",
       "1    1    1     181500  \n",
       "2    1    1     223500  \n",
       "3    1    1     140000  \n",
       "4    1    1     250000  \n",
       "\n",
       "[5 rows x 344 columns]"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# path to where the data lies\n",
    "dpath = './'\n",
    "train_data = pd.read_csv(dpath +\"AmesHouse_FE_train_ym.csv\")\n",
    "test_data = pd.read_csv(dpath +\"AmesHouse_FE_test_ym.csv\")\n",
    "\n",
    "test_id = test_data['Id']\n",
    "test_data=test_data.drop(\"Id\",axis =1)\n",
    "#通过观察前5行，了解数据每列（特征）的概况\n",
    "train_data.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2.2、数据基本信息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1456, 344)"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_data.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>...</th>\n",
       "      <th>334</th>\n",
       "      <th>335</th>\n",
       "      <th>336</th>\n",
       "      <th>337</th>\n",
       "      <th>338</th>\n",
       "      <th>339</th>\n",
       "      <th>340</th>\n",
       "      <th>341</th>\n",
       "      <th>342</th>\n",
       "      <th>SalePrice</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>1.456000e+03</td>\n",
       "      <td>1.456000e+03</td>\n",
       "      <td>1.456000e+03</td>\n",
       "      <td>1.456000e+03</td>\n",
       "      <td>1.456000e+03</td>\n",
       "      <td>1.456000e+03</td>\n",
       "      <td>1.456000e+03</td>\n",
       "      <td>1.456000e+03</td>\n",
       "      <td>1.456000e+03</td>\n",
       "      <td>1.456000e+03</td>\n",
       "      <td>...</td>\n",
       "      <td>1456.0</td>\n",
       "      <td>1456.0</td>\n",
       "      <td>1456.0</td>\n",
       "      <td>1456.0</td>\n",
       "      <td>1456.0</td>\n",
       "      <td>1456.0</td>\n",
       "      <td>1456.0</td>\n",
       "      <td>1456.0</td>\n",
       "      <td>1456.0</td>\n",
       "      <td>1456.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>4.614166e-14</td>\n",
       "      <td>-3.271926e-14</td>\n",
       "      <td>2.301055e-13</td>\n",
       "      <td>9.260926e-14</td>\n",
       "      <td>-9.269382e-13</td>\n",
       "      <td>6.070262e-14</td>\n",
       "      <td>-7.155734e-14</td>\n",
       "      <td>1.076807e-12</td>\n",
       "      <td>-2.059672e-13</td>\n",
       "      <td>2.256631e-13</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>180151.233516</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>1.000344e+00</td>\n",
       "      <td>1.000344e+00</td>\n",
       "      <td>1.000344e+00</td>\n",
       "      <td>1.000344e+00</td>\n",
       "      <td>1.000344e+00</td>\n",
       "      <td>1.000344e+00</td>\n",
       "      <td>1.000344e+00</td>\n",
       "      <td>1.000344e+00</td>\n",
       "      <td>1.000344e+00</td>\n",
       "      <td>1.000344e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>76696.592530</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>-1.691837e+00</td>\n",
       "      <td>-9.281155e-01</td>\n",
       "      <td>-1.554563e+01</td>\n",
       "      <td>-2.433785e-01</td>\n",
       "      <td>-4.486961e+00</td>\n",
       "      <td>-3.814446e+01</td>\n",
       "      <td>-7.007295e+00</td>\n",
       "      <td>-2.641321e+00</td>\n",
       "      <td>-2.696860e+00</td>\n",
       "      <td>-3.285242e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>34900.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>-4.516607e-01</td>\n",
       "      <td>-2.952139e-01</td>\n",
       "      <td>6.432675e-02</td>\n",
       "      <td>-2.433785e-01</td>\n",
       "      <td>-1.028509e+00</td>\n",
       "      <td>2.621613e-02</td>\n",
       "      <td>2.260418e-01</td>\n",
       "      <td>-6.940990e-01</td>\n",
       "      <td>-4.192334e-01</td>\n",
       "      <td>-5.692198e-01</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>129900.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>1.684272e-01</td>\n",
       "      <td>-9.944678e-02</td>\n",
       "      <td>6.432675e-02</td>\n",
       "      <td>-2.433785e-01</td>\n",
       "      <td>7.007165e-01</td>\n",
       "      <td>2.621613e-02</td>\n",
       "      <td>2.260418e-01</td>\n",
       "      <td>-6.940990e-01</td>\n",
       "      <td>-4.192334e-01</td>\n",
       "      <td>2.698005e-02</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>163000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>6.408751e-01</td>\n",
       "      <td>1.155699e-01</td>\n",
       "      <td>6.432675e-02</td>\n",
       "      <td>-2.433785e-01</td>\n",
       "      <td>7.007165e-01</td>\n",
       "      <td>2.621613e-02</td>\n",
       "      <td>2.260418e-01</td>\n",
       "      <td>1.253123e+00</td>\n",
       "      <td>-4.192334e-01</td>\n",
       "      <td>9.544021e-01</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>214000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>7.550426e+00</td>\n",
       "      <td>2.077593e+01</td>\n",
       "      <td>6.432675e-02</td>\n",
       "      <td>5.125698e+00</td>\n",
       "      <td>7.007165e-01</td>\n",
       "      <td>2.621613e-02</td>\n",
       "      <td>2.260418e-01</td>\n",
       "      <td>1.253123e+00</td>\n",
       "      <td>1.858393e+00</td>\n",
       "      <td>1.285624e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>625000.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8 rows × 344 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                  0             1             2             3             4  \\\n",
       "count  1.456000e+03  1.456000e+03  1.456000e+03  1.456000e+03  1.456000e+03   \n",
       "mean   4.614166e-14 -3.271926e-14  2.301055e-13  9.260926e-14 -9.269382e-13   \n",
       "std    1.000344e+00  1.000344e+00  1.000344e+00  1.000344e+00  1.000344e+00   \n",
       "min   -1.691837e+00 -9.281155e-01 -1.554563e+01 -2.433785e-01 -4.486961e+00   \n",
       "25%   -4.516607e-01 -2.952139e-01  6.432675e-02 -2.433785e-01 -1.028509e+00   \n",
       "50%    1.684272e-01 -9.944678e-02  6.432675e-02 -2.433785e-01  7.007165e-01   \n",
       "75%    6.408751e-01  1.155699e-01  6.432675e-02 -2.433785e-01  7.007165e-01   \n",
       "max    7.550426e+00  2.077593e+01  6.432675e-02  5.125698e+00  7.007165e-01   \n",
       "\n",
       "                  5             6             7             8             9  \\\n",
       "count  1.456000e+03  1.456000e+03  1.456000e+03  1.456000e+03  1.456000e+03   \n",
       "mean   6.070262e-14 -7.155734e-14  1.076807e-12 -2.059672e-13  2.256631e-13   \n",
       "std    1.000344e+00  1.000344e+00  1.000344e+00  1.000344e+00  1.000344e+00   \n",
       "min   -3.814446e+01 -7.007295e+00 -2.641321e+00 -2.696860e+00 -3.285242e+00   \n",
       "25%    2.621613e-02  2.260418e-01 -6.940990e-01 -4.192334e-01 -5.692198e-01   \n",
       "50%    2.621613e-02  2.260418e-01 -6.940990e-01 -4.192334e-01  2.698005e-02   \n",
       "75%    2.621613e-02  2.260418e-01  1.253123e+00 -4.192334e-01  9.544021e-01   \n",
       "max    2.621613e-02  2.260418e-01  1.253123e+00  1.858393e+00  1.285624e+00   \n",
       "\n",
       "           ...           334     335     336     337     338     339     340  \\\n",
       "count      ...        1456.0  1456.0  1456.0  1456.0  1456.0  1456.0  1456.0   \n",
       "mean       ...           1.0     1.0     1.0     1.0     1.0     1.0     1.0   \n",
       "std        ...           0.0     0.0     0.0     0.0     0.0     0.0     0.0   \n",
       "min        ...           1.0     1.0     1.0     1.0     1.0     1.0     1.0   \n",
       "25%        ...           1.0     1.0     1.0     1.0     1.0     1.0     1.0   \n",
       "50%        ...           1.0     1.0     1.0     1.0     1.0     1.0     1.0   \n",
       "75%        ...           1.0     1.0     1.0     1.0     1.0     1.0     1.0   \n",
       "max        ...           1.0     1.0     1.0     1.0     1.0     1.0     1.0   \n",
       "\n",
       "          341     342      SalePrice  \n",
       "count  1456.0  1456.0    1456.000000  \n",
       "mean      1.0     1.0  180151.233516  \n",
       "std       0.0     0.0   76696.592530  \n",
       "min       1.0     1.0   34900.000000  \n",
       "25%       1.0     1.0  129900.000000  \n",
       "50%       1.0     1.0  163000.000000  \n",
       "75%       1.0     1.0  214000.000000  \n",
       "max       1.0     1.0  625000.000000  \n",
       "\n",
       "[8 rows x 344 columns]"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_data.describe()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2.3、数据准备"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>...</th>\n",
       "      <th>333</th>\n",
       "      <th>334</th>\n",
       "      <th>335</th>\n",
       "      <th>336</th>\n",
       "      <th>337</th>\n",
       "      <th>338</th>\n",
       "      <th>339</th>\n",
       "      <th>340</th>\n",
       "      <th>341</th>\n",
       "      <th>342</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.227483</td>\n",
       "      <td>-0.202770</td>\n",
       "      <td>0.064327</td>\n",
       "      <td>-0.243378</td>\n",
       "      <td>0.700717</td>\n",
       "      <td>0.026216</td>\n",
       "      <td>0.226042</td>\n",
       "      <td>1.253123</td>\n",
       "      <td>-0.419233</td>\n",
       "      <td>1.053769</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.670403</td>\n",
       "      <td>-0.086107</td>\n",
       "      <td>0.064327</td>\n",
       "      <td>-0.243378</td>\n",
       "      <td>0.700717</td>\n",
       "      <td>0.026216</td>\n",
       "      <td>0.226042</td>\n",
       "      <td>-0.694099</td>\n",
       "      <td>1.858393</td>\n",
       "      <td>0.159469</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.316067</td>\n",
       "      <td>0.081281</td>\n",
       "      <td>0.064327</td>\n",
       "      <td>-0.243378</td>\n",
       "      <td>-1.028509</td>\n",
       "      <td>0.026216</td>\n",
       "      <td>0.226042</td>\n",
       "      <td>1.253123</td>\n",
       "      <td>-0.419233</td>\n",
       "      <td>0.987524</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.079843</td>\n",
       "      <td>-0.091179</td>\n",
       "      <td>0.064327</td>\n",
       "      <td>-0.243378</td>\n",
       "      <td>-1.028509</td>\n",
       "      <td>0.026216</td>\n",
       "      <td>0.226042</td>\n",
       "      <td>1.253123</td>\n",
       "      <td>-0.419233</td>\n",
       "      <td>-1.860986</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.788515</td>\n",
       "      <td>0.386636</td>\n",
       "      <td>0.064327</td>\n",
       "      <td>-0.243378</td>\n",
       "      <td>-1.028509</td>\n",
       "      <td>0.026216</td>\n",
       "      <td>0.226042</td>\n",
       "      <td>1.253123</td>\n",
       "      <td>-0.419233</td>\n",
       "      <td>0.954402</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 343 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          0         1         2         3         4         5         6  \\\n",
       "0  0.227483 -0.202770  0.064327 -0.243378  0.700717  0.026216  0.226042   \n",
       "1  0.670403 -0.086107  0.064327 -0.243378  0.700717  0.026216  0.226042   \n",
       "2  0.316067  0.081281  0.064327 -0.243378 -1.028509  0.026216  0.226042   \n",
       "3  0.079843 -0.091179  0.064327 -0.243378 -1.028509  0.026216  0.226042   \n",
       "4  0.788515  0.386636  0.064327 -0.243378 -1.028509  0.026216  0.226042   \n",
       "\n",
       "          7         8         9 ...   333  334  335  336  337  338  339  340  \\\n",
       "0  1.253123 -0.419233  1.053769 ...     1    1    1    1    1    1    1    1   \n",
       "1 -0.694099  1.858393  0.159469 ...     1    1    1    1    1    1    1    1   \n",
       "2  1.253123 -0.419233  0.987524 ...     1    1    1    1    1    1    1    1   \n",
       "3  1.253123 -0.419233 -1.860986 ...     1    1    1    1    1    1    1    1   \n",
       "4  1.253123 -0.419233  0.954402 ...     1    1    1    1    1    1    1    1   \n",
       "\n",
       "   341  342  \n",
       "0    1    1  \n",
       "1    1    1  \n",
       "2    1    1  \n",
       "3    1    1  \n",
       "4    1    1  \n",
       "\n",
       "[5 rows x 343 columns]"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "house_price= np.log(train_data['SalePrice']) #将price取log，以便拟合回归系数不要太大\n",
    "train_data = train_data.drop('SalePrice', axis = 1)\n",
    "train_data.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2.4 数据分离测试集与验证集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 1164 entries, 472 to 1379\n",
      "Columns: 343 entries, 0 to 342\n",
      "dtypes: float64(97), int64(246)\n",
      "memory usage: 3.1 MB\n",
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 292 entries, 163 to 1056\n",
      "Columns: 343 entries, 0 to 342\n",
      "dtypes: float64(97), int64(246)\n",
      "memory usage: 784.8 KB\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "count    292.000000\n",
       "mean      12.015045\n",
       "std        0.385490\n",
       "min       10.460242\n",
       "25%       11.794338\n",
       "50%       11.983554\n",
       "75%       12.257207\n",
       "max       13.229568\n",
       "Name: SalePrice, dtype: float64"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#将数据分割训练集与验证集\n",
    "from sklearn.cross_validation import train_test_split\n",
    "\n",
    "# 随机采样20%的数据构建验证样本，其余作为训练样本\n",
    "X_train, X_validate, y_train, y_validate = train_test_split(train_data, house_price, random_state=20, test_size=0.2)\n",
    "\n",
    "X_train.info()\n",
    "X_validate.info()\n",
    "\n",
    "y_train.describe()\n",
    "y_validate.describe()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3、确定模型类型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.1 最小二乘"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('test_predict is ', array([ 11.62887128,  11.99661879,  12.14458533, ...,  12.018149  ,\n",
      "        11.69024624,  12.35368257]))\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([  7.13785598e-03,   1.42368619e-02,   1.09815711e-02,\n",
       "        -1.84117220e-04,  -3.25574380e-04,   3.56193083e+05,\n",
       "        -1.15997989e-03,  -7.99015084e+04,  -2.28546654e-02,\n",
       "         5.34688359e-02,   1.60817181e-02,   4.69340295e-03,\n",
       "        -2.04926323e+05,  -1.91085075e-03,  -1.70862521e-03,\n",
       "         2.27120513e-03,   1.54996666e-02,   4.93597346e-03,\n",
       "         8.27700295e+08,  -1.03345751e-03,   3.10727596e+08,\n",
       "         8.50673888e+08,   1.03469687e+09,   1.14087083e-02,\n",
       "        -4.01530749e+08,  -4.69181390e+08,  -1.53131718e+08,\n",
       "         3.76551266e+09,   2.83749129e+09,   6.51998592e+08,\n",
       "         3.00345020e+09,   1.37792491e+09,  -1.55361279e-02,\n",
       "         4.05019534e-03,   6.73763894e-02,   1.23311427e-02,\n",
       "         2.56773683e-02,   2.13201282e+05,   5.12948024e-03,\n",
       "        -1.72436370e-03,   3.81597293e+05,  -2.24874121e+00,\n",
       "        -2.12028293e-02,  -7.89637673e-03,   1.65888982e-03,\n",
       "         1.32030805e-02,  -2.78569507e+09,  -2.60836450e+09,\n",
       "        -1.25136606e+09,  -2.37972676e+09,  -3.14295290e-03,\n",
       "        -4.38556790e-02,   1.18957570e-02,  -1.30903195e-05,\n",
       "         8.20860159e-02,   9.12527723e-03,  -4.74768147e-03,\n",
       "        -6.54058286e-02,  -2.13201271e+05,   2.65744212e-02,\n",
       "         5.69195930e-02,  -4.26726618e+09,  -3.37229902e+09,\n",
       "        -1.01272567e+09,   4.46972268e+09,   2.06739065e+05,\n",
       "        -1.66156128e+04,  -1.26831408e-01,   1.62523947e-01,\n",
       "         3.94877192e-01,   5.31323456e+00,  -1.78637677e+00,\n",
       "         3.70004571e+00,  -5.04222877e+00,   1.68029804e+00,\n",
       "        -3.57931562e+00,  -9.36405157e+04,   9.42540701e+04,\n",
       "         8.01974739e+04,  -1.93388823e+05,   5.17831285e+04,\n",
       "        -3.05468390e+05,   5.27112814e-02,  -5.03192110e-02,\n",
       "        -7.65703932e-02,   1.46162296e+00,  -4.86699044e-01,\n",
       "         1.56905502e+00,   2.49128546e+00,  -7.56211053e-01,\n",
       "         2.21969305e+00,  -2.15272609e+04,   5.36279480e+04,\n",
       "         1.72825644e+05,   2.27820283e+00,  -7.18936766e-01,\n",
       "         1.92910450e+00,  -4.74459037e+04,  -4.74459120e+04,\n",
       "        -6.93182082e+04,  -4.74459070e+04,  -4.74458969e+04,\n",
       "         1.27624350e+05,  -2.82415706e+03,  -2.82407974e+03,\n",
       "         1.03803160e+05,   5.38346758e+04,   5.38346555e+04,\n",
       "         5.38347324e+04,   5.38347042e+04,   5.38347049e+04,\n",
       "         5.38346348e+04,   5.38347174e+04,   5.38346447e+04,\n",
       "         5.38347916e+04,   3.26829274e+04,  -3.58956305e+04,\n",
       "        -3.58953114e+04,  -3.58953170e+04,  -3.58950582e+04,\n",
       "        -3.58953807e+04,  -1.80371895e+05,  -3.58953033e+04,\n",
       "        -3.58952693e+04,  -1.39813530e+05,  -2.02483935e+04,\n",
       "        -2.02483788e+04,  -2.02484463e+04,   1.41900905e+05,\n",
       "        -2.02484055e+04,  -2.02484124e+04,   3.71952088e+04,\n",
       "         3.71951543e+04,   3.71949919e+04,   3.71952410e+04,\n",
       "         3.17041722e+04,   3.71950724e+04,   3.71951582e+04,\n",
       "         3.71952183e+04,   3.71952092e+04,   3.71951881e+04,\n",
       "         3.71953416e+04,   3.71951775e+04,   3.71951536e+04,\n",
       "         3.71951401e+04,   3.71951797e+04,   1.11972028e+05,\n",
       "        -3.41503379e+04,  -3.41502412e+04,  -3.41502976e+04,\n",
       "        -3.41503207e+04,  -2.86594344e+04,  -3.41501573e+04,\n",
       "        -3.41502958e+04,  -3.41503105e+04,  -3.41503016e+04,\n",
       "         8.79004680e+04,  -3.41503088e+04,  -3.41503048e+04,\n",
       "        -3.41502669e+04,  -3.41502637e+04,  -3.41502590e+04,\n",
       "        -3.41503038e+04,  -2.62378224e+03,  -1.08233550e+05,\n",
       "        -1.08233565e+05,  -1.08233545e+05,  -1.08233596e+05,\n",
       "        -1.08233545e+05,  -1.08006670e+04,   1.02929935e+05,\n",
       "         1.02929963e+05,   1.02929987e+05,   1.02929961e+05,\n",
       "         1.02930006e+05,   1.02929806e+05,  -1.02585524e+05,\n",
       "        -5.07677400e+04,  -2.38597937e+05,  -5.07677539e+04,\n",
       "        -5.07677634e+04,  -2.18240656e+04,  -5.45658430e+04,\n",
       "        -5.45657395e+04,  -5.45656984e+04,  -5.45657420e+04,\n",
       "        -5.45657119e+04,  -5.45657389e+04,  -2.18559827e+05,\n",
       "        -4.35148875e+04,   1.18253817e+04,   1.18254301e+04,\n",
       "         1.18254414e+04,   1.18252376e+04,   1.18254936e+04,\n",
       "         1.18254268e+04,  -2.18235180e+04,  -6.09572903e+04,\n",
       "        -6.09569805e+04,  -6.09573160e+04,  -6.09572816e+04,\n",
       "        -6.09572646e+04,  -6.09573018e+04,  -6.09573338e+04,\n",
       "        -6.09572386e+04,   2.57095915e+04,   1.70189902e+04,\n",
       "         1.70190025e+04,   1.70189659e+04,   1.70189766e+04,\n",
       "        -1.68517925e+04,  -1.35272787e+05,  -1.35272764e+05,\n",
       "        -1.35272819e+05,  -1.35272851e+05,  -1.35272804e+05,\n",
       "        -2.86685723e+02,  -1.24419914e+04,  -2.96993559e+04,\n",
       "        -1.24420803e+04,  -1.24420232e+04,  -1.24418915e+04,\n",
       "        -1.24419438e+04,  -1.24419853e+04,  -1.24420317e+04,\n",
       "        -1.24422629e+04,  -1.24419801e+04,  -1.24419980e+04,\n",
       "        -1.24419247e+04,  -1.24420163e+04,  -1.24420168e+04,\n",
       "        -1.24419447e+04,   9.43033330e+03,  -3.21818643e+04,\n",
       "         5.74219033e+04,   5.74223266e+04,   5.74222611e+04,\n",
       "         5.74222758e+04,   5.74222323e+04,   1.95919967e+04,\n",
       "        -9.14287021e+04,  -9.14286485e+04,   3.30264843e+05,\n",
       "        -9.14286162e+04,  -9.82910182e+03,  -2.98426686e+04,\n",
       "        -2.98423728e+04,  -2.98425293e+04,  -2.98423845e+04,\n",
       "        -2.98426741e+04,  -3.98044698e+03,  -1.23748852e+03,\n",
       "        -1.23749393e+03,  -1.23749336e+03,  -1.23751864e+03,\n",
       "        -1.23749439e+03,  -1.23749428e+03,  -1.23749419e+03,\n",
       "        -1.23750820e+03,  -1.23748546e+03,  -1.23749577e+03,\n",
       "        -1.23750115e+03,  -1.23749407e+03,   0.00000000e+00,\n",
       "         6.28185467e+03,   6.28189878e+03,   6.28190683e+03,\n",
       "         6.28196475e+03,   6.28191603e+03,   6.28188178e+03,\n",
       "         6.28200460e+03,   6.28181646e+03,   6.28187399e+03,\n",
       "         6.28188794e+03,   6.28174879e+03,   6.28186445e+03,\n",
       "         6.28187338e+03,   6.28193581e+03,   6.28190339e+03,\n",
       "         6.28192885e+03,   6.28198714e+03,   6.28186745e+03,\n",
       "         6.28191564e+03,   6.28189224e+03,   6.28188956e+03,\n",
       "         6.28191783e+03,   6.28203571e+03,   6.28190626e+03,\n",
       "         6.28197099e+03,   0.00000000e+00,  -9.37458282e+03,\n",
       "        -9.37447822e+03,   0.00000000e+00,   0.00000000e+00,\n",
       "        -9.37467897e+03,  -9.37458421e+03,  -9.37442322e+03,\n",
       "         0.00000000e+00,   9.18619328e+03,   9.18611473e+03,\n",
       "         9.18608942e+03,   9.18613258e+03,   9.18610808e+03,\n",
       "         9.18637614e+03,   0.00000000e+00,  -2.54000393e+04,\n",
       "        -2.53999101e+04,  -2.54000274e+04,  -2.53999863e+04,\n",
       "        -2.53999829e+04,   3.43461290e+04,   0.00000000e+00,\n",
       "         2.51360301e+04,   2.51361255e+04,   0.00000000e+00,\n",
       "         2.51361248e+04,   2.51360573e+04,   2.51360843e+04,\n",
       "         2.51361345e+04,   0.00000000e+00,   2.51360319e+04,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00])"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 线性回归\n",
    "#class sklearn.linear_model.LinearRegression(fit_intercept=True, normalize=False, copy_X=True, n_jobs=1)\n",
    "from sklearn.linear_model import LinearRegression\n",
    "\n",
    "# 使用默认配置初始化\n",
    "lr = LinearRegression()\n",
    "\n",
    "# 训练模型参数\n",
    "lr.fit(X_train, y_train)\n",
    "\n",
    "# 预测\n",
    "lr_validate_predict = lr.predict(X_validate)\n",
    "lr_train_predict = lr.predict(X_train)\n",
    "lr_test_predict = lr.predict(test_data)\n",
    "\n",
    "print(\"test_predict is \",lr_test_predict)\n",
    "#显示特征的回归系数\n",
    "lr.coef_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.1.1 模型评价"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The value of default measurement of LinearRegression on validate is 0.949430425007\n",
      "The value of default measurement of LinearRegression on validate is -4.27627455239e+12\n",
      "The value of MRSE of LinearRegression on train is 0.0896504383154\n",
      "The value of MRSE of LinearRegression on validate is 795794.137639\n"
     ]
    }
   ],
   "source": [
    "# 使用LinearRegression模型自带的评估模块（r2_score），并输出评估结果\n",
    "#R2\n",
    "print 'The value of default measurement of LinearRegression on validate is', lr.score(X_train,y_train)\n",
    "print 'The value of default measurement of LinearRegression on validate is', lr.score(X_validate,y_validate)\n",
    "#MRSE\n",
    "print 'The value of MRSE of LinearRegression on train is', np.sqrt(mean_squared_error(lr_train_predict, y_train))\n",
    "print 'The value of MRSE of LinearRegression on validate is', np.sqrt(mean_squared_error(lr_validate_predict, y_validate))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在验证集上l2 score分数非常不合理，效果很差"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAe8AAAFsCAYAAADlrTG7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAHfRJREFUeJzt3XuUXWWZ5/HvY1IQm0AgNwwJmICg\nBAJJusBk6ME4UUBQo2u84ACJgsSF0MvWbluBsalW6dYRccmAdOOFi6AQUBum1RFMg1wGwcSJQAhM\nSiBSIYYQ5BIQIeGZP86ueFKpW+qSqrfq+1nrrHPOu9+993veOsnvvO/eZ5/ITCRJUjleM9ANkCRJ\nO8bwliSpMIa3JEmFM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PmkjSIvfTSS4wbN87gHkIignHjxvVqNsXw\nlqRBzuAeenr7NzW8JUkqjMe8JakgTU07f3sjRoxgxowZbN68mWnTpvHd736XPffcc4f39dGPfpRP\nfepTTJ8+fZvyK664gmXLlnHxxRfv8DYBRo8ezaZNm7pVd968eVxwwQU0NjZuLVu2bBlXXXUVF110\nUY/2PxAceUuSOvXa176WFStW8MADDzB27FguueSSHm3nW9/61nbBPRg0Njb2e3Bv2bKlT7dneEuS\num3u3LmsXbt26/OvfOUrHHHEERx22GGcd955ALzwwguccMIJHH744Rx66KFcd911QG3U23op7Msv\nv5yDDjqIt7zlLdx1111bt/fhD3+YG264Yevz0aNHA7Bp0ybmz5/P7NmzmTFjBjfeeON2bVu3bh1H\nH300M2fO5NBDD+WOO+7o1mu67bbbeOc73wlAU1MTp556KvPmzWP//fffJtSvvvpqjjzySGbOnMnH\nPvaxrYF8xhln0NjYyCGHHLK1D6B26e/Pf/7z/NVf/RXXX399t9rSXU6bS5K6ZcuWLSxdupTTTjsN\ngJtvvpnVq1dz7733kpm8+93v5vbbb2fDhg3ss88+/PjHPwbg2Wef3WY769at47zzzmP58uWMGTOG\nt771rcyaNavTfY8aNYof/ehH7LHHHjz11FPMmTOHd7/73duc+PW9732PY489lnPPPZctW7bw4osv\n9uh1PvTQQ9x66608//zzvPGNb+SMM86gubmZ6667jrvuuouGhgY+/vGPc80117Bw4ULOP/98xo4d\ny5YtW5g/fz733Xcfhx122NZ233nnnT1qR2e6HHlHxL4RcWtErIqIlRHxiaq8KSLWRsSK6nZ83Tpn\nR0RzRDwcEcf2easlSTvNH//4R2bOnMm4ceN4+umnefvb3w7Uwvvmm29m1qxZzJ49m4ceeojVq1cz\nY8YMfv7zn/OZz3yGO+64gzFjxmyzvXvuuYd58+YxYcIEdtllFz74wQ922YbM5JxzzuGwww7jbW97\nG2vXrmX9+vXb1DniiCO4/PLLaWpq4v7772f33Xfv0es94YQT2HXXXRk/fjwTJ05k/fr1LF26lOXL\nl3PEEUcwc+ZMli5dyiOPPALAkiVLmD17NrNmzWLlypU8+OCDW7fVndfWE92ZNt8M/G1mHgzMAc6M\niNaDFl/LzJnV7ScA1bITgUOA44BvRMSIfmi7JGknaD3mvWbNGl5++eWtx7wzk7PPPpsVK1awYsUK\nmpubOe200zjooINYvnw5M2bM4Oyzz+bzn//8dtvs6KtSI0eO5NVXX926/ZdffhmAa665hg0bNrB8\n+XJWrFjB3nvvvd33pI8++mhuv/12Jk+ezCmnnMJVV13Vo9e76667bn08YsQINm/eTGayaNGira/1\n4YcfpqmpiUcffZQLLriApUuXct9993HCCSds067ddtutR23oSpfT5pm5DlhXPX4+IlYBkztZZQFw\nbWb+CXg0IpqBI4G7+6C9kvpJd89i7uuznVWOMWPGcNFFF7FgwQLOOOMMjj32WD73uc9x0kknMXr0\naNauXUtDQwObN29m7NixnHzyyYwePZorrrhim+28+c1v5hOf+AQbN25kjz324Prrr+fwww8HaseJ\nly9fzgc+8AFuvPFGXnnlFaA29T5x4kQaGhq49dZbWbNm+1/OXLNmDZMnT+b000/nhRde4Ne//jUL\nFy7sk9c+f/58FixYwCc/+UkmTpzI008/zfPPP89zzz3HbrvtxpgxY1i/fj0//elPmTdvXp/sszM7\ndMw7IqYCs4B7gKOAsyJiIbCM2uj8D9SC/Zd1q7XQTthHxGJgMcB+++3Xg6ZL0vAz0B+eZs2axeGH\nH861117LKaecwqpVq5g7dy5QO7ns6quvprm5mU9/+tO85jWvoaGhgUsvvXSbbUyaNImmpibmzp3L\npEmTmD179taTv04//XQWLFjAkUceyfz587eOXE866STe9a530djYyMyZM3nTm960Xdtuu+02vvKV\nr9DQ0MDo0aM7HHmfcMIJW68pPnfuXM4888wuX/f06dP54he/yDHHHMOrr75KQ0MDl1xyCXPmzGHW\nrFkccsgh7L///hx11FHd78xeiMzsXsWI0cAvgPMz84cRsTfwFJDAF4BJmXlqRFwC3J2ZV1frfRv4\nSWb+oKNtNzY2ZusZiJIGhiPvwWnVqlUcfPDBA90M9YP2/rYRsTwzG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1/2RE/Ija4Yb1ETEpM9dV07ZPVtU76tMWYF6b8tuq\n8int1B8OdkYfdrSPQc1p8/51E3BidSbzNOBAaidNtHv52OpYzK3A+6r1FwE31m2r9czJ9wH/UdXv\naB9DRvUPqtV7gdazUXdG/w53Xuq4CxGxW0Ts3voYOIbae7T+PdX2vbawOmN6DvBsNV37M+CYiNir\nOjR0DPCzatnzETGnOg9jYd22hrqd0Ycd7WNwG+gz5obCjVqgtAB/AtZTe7O0LjuX2tm6D1N3hii1\nsyX/X7Xs3Lry/akFUDNwPbBrVT6qet5cLd+/q30MlRvwXeB+4D5q/9Am7cz+He63jvrS29b+2Z/a\nWfi/AVa29hG1cyaWAqur+7FVeQCXVP15P9t+Q+XU6j3YDHykrryR2geC3wIXU10dcyjdgO8D64BX\nqv9PT9sZfdjRPgb7zcujSpJUGKfNJUkqjOEtSVJhDG9JkgpjeEuSVBjDW5KkwhjekiQVxvCWJKkw\n/x8x9A6O9sTzkQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x101e6b38>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#在训练集上观察预测残差的分布，看是否符合模型假设：噪声为0均值的高斯噪声\n",
    "f, ax = plt.subplots(figsize=(7, 5)) \n",
    "f.tight_layout() \n",
    "ax.hist(np.exp(y_train) - np.exp(lr_train_predict),bins=40, label='Residuals Linear', color='b', alpha=.5); \n",
    "ax.set_title(\"Histogram of Residuals\") \n",
    "ax.legend(loc='best');"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "训练集残差分布和高斯分布比较匹配"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQ8AAADQCAYAAAAZMORwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxv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9rqjKJ+aikPSXN4rmd\n0H4MfLT6QtJ+TU5ziKThSkOkI4Fbprjsj4H3VocrNcOWtNezkjh52FTOIhlm3ETyVGfVR4E3ViY2\nf0XSr7WR/yXpOTEOLImIla0uFhF3AhcBN0taCSxq83pWEi/VWmEkfZCkeXBHOsdbsXznYWaZ+M7D\nzDLxnYeZZeLkYWaZOHmYWSZOHmaWiZOHmWXy/yr9mQXjSARTAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1024a438>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#还可以在训练集观察预测值与真值的散点图\n",
    "plt.figure(figsize=(4, 3))\n",
    "plt.scatter(y_train, lr_train_predict)\n",
    "plt.plot([8, 8], [10, 10], '--k')   #数据已经标准化，3倍标准差即可\n",
    "plt.axis('tight')\n",
    "plt.xlabel('True price')\n",
    "plt.ylabel('Predicted price')\n",
    "plt.tight_layout()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "训练集上分布较均匀"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#在验证集上观察 y_validate与预测值分布"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAe8AAAF5CAYAAAC2tqKTAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAHsFJREFUeJzt3Xu0XWV97vHvAwQCgkJDwqEECZVo\nRcQQI8VWKRaLQK2BMdSGooJiQ6to6+k5p1hv2Kq1PSqVUS+NyiFWkKB4oT14RTmpCmgiEYEoRERI\nQQjh6hCQJL/zx5obtmEneyX7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vR2vw23i2Nb1ddlaJO8EHgL8PtV9fA41TYWhhvvHsAhwOXdP4r/BlyS5CVV\ntWzcqhwd/f4uX1lVjwA/TfJjemH+vfEpcVT1M97TgGMBquqKJFPp3eih5cMFmzLpLjGd5FDg48Bx\nVbV2ousZQ/OAC7v/o/YGjk+yrqq+sCUL2d52m/dzWdZLgFO65y8FvlHdGQQNGna83W7kfwVe0vgx\nURhmvFV1X1XtXVWzqmoWvWNnLQY39Pe7/AV6JySSZG96u9FvGtcqR08/470FOBogydOBqcCaca1y\n/FwCvKo76/wI4L6qun2iixorSZ4MfA54ZVXdMNH1jKWqOnDQ/1GfBV63pcEN29mWd23isqxJ/g5Y\nVlWXAJ+gt7ttFb0t7gUTV/HI9Dne/w3sDnym+6Z3S1W9ZMKKHoE+x7td6HOsXwGOSXI9sB74n61u\nsfQ53r8GPpbkTfR2IZ/a6hfvJJ+md7hj7+4Y/juAKQBV9VF6x/SPB1YBvwRePTGVjo4+xvt2euce\nfbj7f2pdNXqnsT7GOjrrafR3X5KkSWt7220uSdJ2z/CWJKkxhrckSY0xvCVJaozhLUnSCPV7Q5Ku\n79lJVnQ/NyTZ4gsreba5JEkjlORI4Bf0rkl/yBbM9wbgsKp6zZaszy1vSZJGaKgbkiR5SpIvJ1me\n5D+T/PYQs54EfHpL17ddXaRFkqRtyCLgz6vqxiS/A3wY+IOBiUkOAA6kd3vQLWJ4S5I0ypLsTu8+\n5QNXtwTYZaNuC4DPVtX6LV2+4S1J0ujbAbi3quZsps8C4PVbu3BJkjSKqup+enf7exlAd5OZZw1M\nT/I0YC/giq1ZvuEtSdIIdTckuQJ4WpLVSU4DTgZOS/ID4Dpg/qBZTgIu3Nqb6/inYpIkNcYtb0mS\nGmN4S5LUGMNbkqTGGN6SJDXG8JYkqTGGtyRJjTG8JUlqzP8HkoPgHNnYQWkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xd126208>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "f, ax = plt.subplots(figsize=(7, 5)) \n",
    "f.tight_layout() \n",
    "ax.hist(y_validate-lr_validate_predict,bins=40, label='y_validate', color='b', alpha=.5); \n",
    "ax.set_title(\"Histogram of y_validate\") \n",
    "ax.legend(loc='best');"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "从该图上可以看出，有一些预测值与真值偏差的太大"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAR8AAADQCAYAAAA+nmWYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAFKdJREFUeJzt3XvUVXWdx/H3J8DES6FCJihB5sIY\nKygyyxlntBzNcQRdVljTmJpmY6lZZKxak9PkpOJINdPN8YZlmhmSZop4KZtWXlCQi4TXmrgUmJKl\nJBe/88f+HT08Pec8++GcvffhOZ/XWmeds2/n933g4cv+/fbev68iAjOzsr2s6gDMrDs5+ZhZJZx8\nzKwSTj5mVgknHzOrhJOPmVWi65KPpMskrZG0JMe+MyUtTK+HJa0rI0azbqBuu89H0kHAn4ArI2K/\nfhz3cWBiRJxYWHBmXaTrznwi4i7gqfp1kvaWdIuk+yX9TNK+vRx6HHB1KUGadYHBVQfQIS4GTo2I\nRyS9Dfg6cEhto6TXAGOBOyqKz2zA6frkI2kn4B3A9yXVVr+8x25TgesiYnOZsZkNZF2ffMi6nusi\nYkKTfaYCp5UUj1lX6Loxn54i4hngCUnvAVDmTbXtksYBuwC/qChEswGp65KPpKvJEsk4SSsknQR8\nADhJ0oPAUmBy3SHHAddEt10WNCtY111qN7PO0HVnPmbWGbpqwHn48OExZsyYqsMwG7Duv//+JyNi\nRJ59uyr5jBkzhvnz51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qDwE9L2kfSy4Cj6zbfBpxWW5A0ocHX/H2a\nG3oHsvl6ft5Hs7cBU2vdrbpuV972rAROPlaGs8m6SbeTzflTcxpwYBoYfgg4ucHx/wt8F1gAXB0R\nC5s1FhGLgAuAuyQtBGb0sz0rgS+1W0eT9GGyidDPrDoWay+f+ZhZJXzmY2aV8JmPmVXCycfMKuHk\nY2aVcPIxs0o4+ZhZJf4fRAY3YBWYpbUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x105af208>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#还可以在验证集观察预测值与真值的散点图\n",
    "plt.figure(figsize=(4, 3))\n",
    "plt.scatter(y_validate, lr_validate_predict)\n",
    "plt.plot([1, 1], [3, 3], '--k')   #数据已经标准化，3倍标准差即可\n",
    "plt.axis('tight')\n",
    "plt.xlabel('True price')\n",
    "plt.ylabel('Predicted price')\n",
    "plt.tight_layout()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "尝试一下：\n",
    "验证集上分布观测值与预测值分布非常不均衡，发现有几个非常大的离群点，尝试剔除掉改点后，再计算一下L2 SCORE看是否可以回归正常"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(array([ 78,  93,  96, 100, 125, 154, 166, 176, 211, 237, 250], dtype=int64),)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAARgAAADQCAYAAADcQn7hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAGihJREFUeJzt3X2UHXV9x/H3J8sCN0jZICs1KzGU\ncpIC8qArammtwUooYozgE/Wc4hNIlSpqU0L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vDOiurJW2T\n9LGY57xQ0mipHoukd4V1TjZK+nrS57n8eBPJNeoE4F1mdomkan+Pvgh8xszWSppLUI/kpIjrTg/P\n7wXWSboDeLr8OQDBiwxIOoVg+v4fm9kuSUfW+TyXA08wrlG/NLN1Ca77c2BeKTEAsyQVzGy84rrV\nZvYkgKQh4E8IVr3HPedM4KbSUomyJRNJn+dy4AnGNWp32fdTgMqODy37XiTrEK7sDCwd7668sOxz\nozoQkz7P5cD7YNy0hR2vT0o6XtIM9q8U+H3gA6UDSafGfMxZkvrCYmBvBB6s8djvA28vNY3KmkhJ\nn+dy4AnGpeVygibNPcBo2fkPAGeEnbE/JaiLHOWHBLVKRoCVZrah2sPM7CHgM8ADkjYAy+t8nsuB\nD1O7ppP0XoKi2i2904Orn7/BOOcy428wzrnM+BuMcy4znmCcc5nxBOOcy4wnGOdcZjzBOOcy8/9w\nyy4kYsyxzgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xd086cc0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "\n",
    "lr_y_array=np.array(y_validate)\n",
    "lr_x_array=np.array(X_validate)\n",
    "\n",
    "#查看预测值非常离奇的点对应的 lr_x_array的分布\n",
    "print(np.where((lr.predict(lr_x_array)<-0.5)|(lr.predict(lr_x_array)>100)))\n",
    "\n",
    "#剔除预测值非常大或非常小的 validate集\n",
    "normal_points_x=lr_x_array[(lr.predict(lr_x_array)>=-0.5)&(lr.predict(lr_x_array)<=100)]\n",
    "normal_points_y=lr_y_array[np.where((lr.predict(lr_x_array)>=-0.5)&(lr.predict(lr_x_array)<=100))]\n",
    "\n",
    "lr_validate_predict_after_Delete = lr.predict(normal_points_x)\n",
    "\n",
    "plt.figure(figsize=(4, 3))\n",
    "plt.scatter(normal_points_y, lr_validate_predict_after_Delete)\n",
    "plt.plot([9, 9], [13, 13], '--k') \n",
    "plt.axis('tight')\n",
    "plt.xlabel('True price')\n",
    "plt.ylabel('Predicted price')\n",
    "plt.tight_layout()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "发现有11个点的预测值非常离奇，对应的index值列出来"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "去除该11个验证集的点后，l2_score稍微正常，这也说明该模型拟合程度不好，对于一些数据集，没有很好的拟合，尝试剔除掉改点后，再计算一下L2 SCORE"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('After delete innormal predict points, the r2 score is ', 0.87723765514243457)\n",
      "The value of MRSE of LinearRegression on validate is 0.133701023298\n"
     ]
    }
   ],
   "source": [
    "print(\"After delete innormal predict points, the r2 score is \",lr.score(normal_points_x,normal_points_y))\n",
    "#MRSE\n",
    "print 'The value of MRSE of LinearRegression on validate is', np.sqrt(mean_squared_error(lr_validate_predict_after_Delete, normal_points_y))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.1.2 test集上计算 房价预测值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 112293.50252006  162205.41264847  188072.97472969 ...,  165735.59644352\n",
      "  119401.40407283  231812.13830579]\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "f:\\Anaconda2\\lib\\site-packages\\ipykernel_launcher.py:1: RuntimeWarning: overflow encountered in exp\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    }
   ],
   "source": [
    "print(np.exp(lr_test_predict))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.2 L2正则 岭回归"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RidgeCV(alphas=[0.0001, 0.001, 0.01, 0.1, 1, 10, 11, 12, 13, 14, 15, 20, 40, 80, 100],\n",
       "    cv=None, fit_intercept=True, gcv_mode=None, normalize=False,\n",
       "    scoring=None, store_cv_values=True)"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#岭回归／L2正则\n",
    "#class sklearn.linear_model.RidgeCV(alphas=(0.1, 1.0, 10.0), fit_intercept=True, \n",
    "#                                  normalize=False, scoring=None, cv=None, gcv_mode=None, \n",
    "#                                  store_cv_values=False)\n",
    "from sklearn.linear_model import  RidgeCV\n",
    "\n",
    "alphas = [0.0001,0.001,0.01, 0.1, 1, 10,11,12,13,14,15,20, 40, 80,100]\n",
    "reg = RidgeCV(alphas=alphas, store_cv_values=True)   \n",
    "reg.fit(X_train, y_train)       "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZIAAAEKCAYAAAA4t9PUAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3Xl4VvWd9/H3NzskkEASIIQlILuA\naCPiUrGAFNoqttURZ8axLc9jr844bYd6zej4aEe7TJ220jraxVZbx3ZGrW0HqrQqYFGsosGiiGET\nsIYtgWAggRBCvs8f9wmGmOUmJyd3Ej6v68qVs/zOub8/lnzyO6u5OyIiIh2VlOgCRESkZ1OQiIhI\nKAoSEREJRUEiIiKhKEhERCQUBYmIiISiIBERkVAUJCIiEoqCREREQklJdAFdIS8vz4uKihJdhohI\nj7Ju3br97p7fXrszIkiKioooKSlJdBkiIj2Kmb0TTzsd2hIRkVAUJCIiEoqCREREQlGQiIhIKAoS\nEREJJdIgMbN5ZrbZzLaZ2S0trE83s8eC9WvNrChYfrmZrTOzDcH3WU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hEzOxtIdvftXf37pI9TAAACaUlEQVTZ7l4B7DGzi7v6s+XMoyARiYPFfDu4oXODmV0b\nLE8ysx8E73x40syWm9nVwWZ/Ayxtso8fmllJ0PbOVj6n2sy+a2avmdlKM8tvsvoaM3vFzLaY2YeD\n9kVm9kLQ/jUzu6hJ+/8NahCJlIJEJD6fAqYB5wBzgG+bWUGwvAiYAvwfYnenN7oYWNdk/jZ3Lwam\nAjPNbGoLn5MJvObu5wGrOfVZaCnuPh34cpPl5cDlQftrgXubtC8BPnz6XRU5PXrWlkh8LgH+x91P\nAPvMbDVwfrD8V+7eAOw1s+eabFMAVDSZ/yszu5HY/7sCYi+CeqPZ5zTw/iPxfwE0fdhe4/Q6YuEF\nkArcZ2bTgBPAuCbty4Ee+xZM6TkUJCLxae1FNG29oOYokAEQPNTwZuB8dz9oZj9vXNeOps8wOhZ8\nP8H7/3f/CdhHbKSUBNQ2aZ8R1CASKR3aEonP88C1ZpYcnLe4FHgFWAN8OjhXMhi4rMk2pcCYYLo/\nUANUBe3mt/I5SUDjOZa/DvbflmxgTzAiuh5IbrJuHLHX+IpESiMSkfj8ltj5j9eJjRL+2d33mtmv\ngdnEfmBvIfYWuqpgm6eIBcuK4O2afwY2AtuBF1v5nBrgbDNbF+zn2nbq+gHwazO7Bngu2L7RR4Ia\nRCKlp/+KhGRmWe5ebWa5xEYpFwch04fYD/eLg3Mr8eyr2t2zOqmu54EF7n6wM/Yn0hqNSETCe9LM\ncoA04GuNb85096Nm9lVi7zX/S1cWFBx+u0chIl1BIxIREQlFJ9tFRCQUBYmIiISiIBERkVAUJCIi\nEoqCREREQlGQiIhIKP8fmugxeaE7gsUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xd09c048>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('alpha is:', 11.0)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([  4.67157471e-03,   2.02044937e-02,   1.23061071e-02,\n",
       "        -1.64369627e-03,   2.83809385e-04,   4.65593564e-32,\n",
       "         3.62448634e-03,   1.09867037e-02,   1.46467160e-02,\n",
       "         5.18026189e-02,   1.59777801e-02,   1.01120598e-02,\n",
       "         1.17690171e-03,  -8.06029749e-03,  -1.06648689e-03,\n",
       "         7.93594490e-04,   1.62613000e-02,   4.52217339e-03,\n",
       "         2.34913056e-02,  -1.64644494e-03,   2.12327796e-03,\n",
       "        -9.86285704e-03,   1.47732567e-02,   1.15850291e-02,\n",
       "        -5.78013655e-03,   1.07803724e-02,   2.06215030e-03,\n",
       "         5.26915942e-03,  -1.67107383e-03,  -4.50943430e-04,\n",
       "         5.57266493e-03,   1.52309996e-02,  -1.25406512e-02,\n",
       "        -1.68951139e-02,   1.14456845e-02,   1.18572826e-02,\n",
       "         2.83174448e-02,   5.81054662e-03,   6.62569562e-03,\n",
       "        -1.15468935e-03,   6.18061796e-03,  -4.23100078e-03,\n",
       "         9.40071415e-03,   7.18833700e-04,   4.96131783e-03,\n",
       "         1.31954883e-02,   6.36510463e-03,   2.52704518e-04,\n",
       "        -1.25099459e-03,   8.48843151e-03,  -4.90138623e-03,\n",
       "        -2.60826983e-02,   2.83838262e-03,   3.43560563e-04,\n",
       "         3.68492434e-02,  -4.40747934e-03,   5.29635566e-03,\n",
       "        -8.76558559e-03,   5.81054662e-03,   2.35233767e-02,\n",
       "         3.44977828e-02,   7.66034318e-03,   1.14483090e-02,\n",
       "         5.11532998e-03,   8.28352993e-03,  -8.71404966e-04,\n",
       "         7.55799536e-03,  -9.66274057e-03,   1.99441448e-02,\n",
       "         5.82475781e-02,  -1.19323577e-02,  -2.20297617e-03,\n",
       "         3.41989730e-02,  -7.48923012e-03,   1.62918577e-02,\n",
       "         3.46051000e-02,  -9.68946841e-03,  -2.21654179e-02,\n",
       "         2.56829561e-02,   1.02798679e-02,  -7.45673912e-04,\n",
       "         8.44815358e-03,   5.41359235e-03,  -1.17261342e-03,\n",
       "        -7.42051418e-03,   2.31758666e-02,  -1.49954673e-02,\n",
       "        -1.51350950e-02,  -9.62755507e-04,  -6.43512514e-03,\n",
       "         1.70715295e-02,   1.17690171e-03,   1.17690171e-03,\n",
       "         1.17690171e-03,  -2.41376434e-02,   3.88918136e-03,\n",
       "         3.33391748e-02,   1.66064392e-02,   1.25385765e-02,\n",
       "         7.91542164e-03,  -2.43127104e-02,  -1.27477270e-02,\n",
       "         0.00000000e+00,  -3.70522005e-02,   3.70522005e-02,\n",
       "         0.00000000e+00,  -1.12458743e-02,  -2.77543566e-02,\n",
       "         3.60161652e-02,  -4.58420162e-03,  -1.20180504e-03,\n",
       "        -2.28200870e-02,   9.54294268e-03,  -5.53923059e-03,\n",
       "         2.75864474e-02,   0.00000000e+00,  -1.07658915e-02,\n",
       "         2.40383321e-03,  -1.03060660e-03,   1.14158543e-02,\n",
       "        -1.44326652e-03,   0.00000000e+00,  -8.59979957e-04,\n",
       "         2.80057072e-04,   0.00000000e+00,   8.52209819e-04,\n",
       "         8.53906021e-03,   2.86231584e-03,   0.00000000e+00,\n",
       "        -1.31484338e-02,   8.94847949e-04,  -6.57169534e-03,\n",
       "         1.36168008e-03,  -2.18886316e-02,   4.45896181e-02,\n",
       "        -9.52647122e-03,  -6.95904308e-03,  -1.02117178e-02,\n",
       "         1.05816691e-03,   1.28733993e-02,   7.10743940e-03,\n",
       "         6.75284396e-03,   8.35982876e-03,  -8.59937604e-03,\n",
       "        -3.30894173e-02,   1.47433760e-02,   0.00000000e+00,\n",
       "        -1.39889246e-02,   6.11983329e-03,  -1.28480546e-02,\n",
       "        -1.44466008e-02,  -9.52647122e-03,   1.11437893e-02,\n",
       "        -7.50886496e-03,  -9.81268885e-04,   2.15057846e-03,\n",
       "         0.00000000e+00,  -1.32945826e-02,   1.32474023e-02,\n",
       "         1.52595562e-02,   8.49422417e-03,   2.50571030e-02,\n",
       "        -8.87771895e-03,   0.00000000e+00,   7.51250265e-03,\n",
       "        -8.92991980e-03,   1.04801360e-02,  -1.85316493e-02,\n",
       "         9.46893043e-03,   0.00000000e+00,  -1.40139133e-02,\n",
       "        -6.25378525e-04,   2.89494893e-02,   7.08039841e-03,\n",
       "         5.29133561e-03,  -2.66819315e-02,   0.00000000e+00,\n",
       "         1.15033540e-02,  -6.39169774e-03,  -2.18102176e-03,\n",
       "        -2.93063454e-03,   0.00000000e+00,  -2.91848746e-02,\n",
       "         1.33291922e-02,   4.79082632e-03,   1.08336829e-02,\n",
       "        -3.87411636e-03,   1.04969872e-02,  -6.39169774e-03,\n",
       "         0.00000000e+00,   1.36006024e-03,   9.78536524e-03,\n",
       "         1.09209708e-02,  -3.38309248e-02,  -1.94953829e-05,\n",
       "         1.17840239e-02,   0.00000000e+00,  -5.80049038e-03,\n",
       "         1.91802250e-02,  -6.47883558e-03,  -1.89555889e-02,\n",
       "         9.38978185e-03,  -4.51017876e-03,  -1.22110956e-02,\n",
       "         1.93861824e-02,   0.00000000e+00,   6.03368681e-03,\n",
       "         2.53454335e-02,  -2.32305767e-02,  -8.14854357e-03,\n",
       "         0.00000000e+00,   2.43148644e-03,   3.06673667e-02,\n",
       "        -1.93509607e-02,  -5.37819710e-03,  -8.36969535e-03,\n",
       "         0.00000000e+00,   1.57851616e-02,   0.00000000e+00,\n",
       "        -4.22638766e-02,  -1.76163353e-02,   8.11558280e-03,\n",
       "         1.72597914e-02,  -1.76550269e-02,   1.32097374e-03,\n",
       "         4.31305263e-03,   6.36255964e-03,  -1.76639085e-02,\n",
       "         3.84968850e-02,  -1.48706517e-02,  -1.15165868e-03,\n",
       "         1.16520292e-02,   7.91542164e-03,   0.00000000e+00,\n",
       "        -1.08722561e-01,   4.54834821e-02,   3.37391695e-02,\n",
       "         3.44772782e-02,  -4.97736906e-03,   0.00000000e+00,\n",
       "        -3.08301932e-02,  -6.61980027e-04,   4.27214187e-04,\n",
       "         3.10649590e-02,   0.00000000e+00,   2.46380421e-03,\n",
       "         2.10857761e-02,  -1.29638366e-02,   2.18029396e-03,\n",
       "        -1.27660377e-02,   0.00000000e+00,   3.97058143e-03,\n",
       "         2.93618376e-03,   1.08926783e-03,  -1.21773661e-02,\n",
       "         2.91183860e-03,   4.60760949e-03,   3.67981820e-04,\n",
       "        -1.13316190e-02,   1.54117083e-02,  -2.47630169e-03,\n",
       "        -3.38901437e-03,  -1.92087009e-03,   0.00000000e+00,\n",
       "        -3.73130853e-02,  -9.85019856e-04,  -7.43223384e-03,\n",
       "         4.16028468e-02,   1.02125132e-02,  -1.39450557e-02,\n",
       "         8.43512553e-02,  -4.84013881e-02,  -1.72517967e-02,\n",
       "        -3.60696192e-02,  -7.34591641e-02,  -2.70832208e-02,\n",
       "        -1.51380714e-02,   2.27704157e-02,  -5.66223792e-03,\n",
       "         4.28978557e-03,   6.71984366e-02,  -2.83477389e-02,\n",
       "        -4.42843438e-04,  -1.02044034e-02,  -1.66288597e-02,\n",
       "         2.95669807e-02,   6.86872368e-02,  -4.92328449e-03,\n",
       "         1.46085521e-02,   0.00000000e+00,  -2.03129677e-02,\n",
       "         1.41072009e-02,   0.00000000e+00,   0.00000000e+00,\n",
       "        -2.41160266e-02,  -5.22186464e-03,   3.55436581e-02,\n",
       "         0.00000000e+00,  -1.76510097e-03,  -4.74583592e-03,\n",
       "        -1.49200213e-02,   1.49054293e-02,  -5.56013654e-03,\n",
       "         1.20856655e-02,   0.00000000e+00,  -4.25845836e-02,\n",
       "         1.84367851e-02,  -1.16682765e-02,   1.10154419e-02,\n",
       "         2.26987291e-02,   2.10190400e-03,   0.00000000e+00,\n",
       "        -3.04963303e-02,   1.06306843e-02,   0.00000000e+00,\n",
       "         2.85161282e-02,  -8.36304602e-03,   3.49225213e-03,\n",
       "         1.80962443e-02,   0.00000000e+00,  -2.18759327e-02,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00])"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mse_mean = np.mean(reg.cv_values_, axis = 0)\n",
    "plt.plot(np.log10(alphas), mse_mean.reshape(len(alphas),1)) \n",
    "plt.plot(np.log10(reg.alpha_)*np.ones(3), [0.01, 0.015, 0.02])\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()\n",
    "\n",
    "print ('alpha is:', reg.alpha_)\n",
    "reg.coef_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.2.1 模型评估"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "reg_train_predict=reg.predict(X_train)\n",
    "reg_validate_predict=reg.predict(X_validate)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The value of default measurement on train of RidgeRegression is 0.938053434192\n",
      "The value of default measurement on validate of RidgeRegression is 0.904838009726\n",
      "The value of MRSE   on train is 0.0992239205377\n",
      "The value of MRSE   on validate is 0.118713389037\n"
     ]
    }
   ],
   "source": [
    "#使用模型自带的评估模块（r2_score），并输出评估结果\n",
    "print 'The value of default measurement on train of RidgeRegression is', reg.score(X_train, y_train)\n",
    "print 'The value of default measurement on validate of RidgeRegression is', reg.score(X_validate,y_validate)\n",
    "#MRSE\n",
    "print 'The value of MRSE   on train is', np.sqrt(mean_squared_error(reg_train_predict, y_train))\n",
    "print 'The value of MRSE   on validate is', np.sqrt(mean_squared_error(reg_validate_predict, y_validate))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('the predict of train_data is ', array([ 11.78602078,  12.65209422,  12.16899921, ...,  12.23944554,\n",
      "        12.39011103,  11.83312186]))\n"
     ]
    }
   ],
   "source": [
    "#计算 train 上预测的房价\n",
    "reg_train_predict=reg.predict(X_train)\n",
    "print(\"the predict of train_data is \",reg_train_predict)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAe8AAAG0CAYAAAAbwK/5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3Xuc3XV95/HXhyQmSiAITCAQYgKC\nynWCQyRrgdiIYEHArS2wXEskFKTblmIV7ZYp6vYC6paV0kZBQBCCKIVW3YVNiamsoIlmkasJSEpC\nmoQgl3CRJHz2j/Ob9GQykzmZM7dv5vV8POYx53x/t8/5TjLv8/3+fvM7kZlIkqRy7DDYBUiSpG1j\neEuSVBjDW5KkwhjekiQVxvCWJKkwhrckSYUxvKVuRMQjETFjsOsYTBHx0Yh4JiLWRcTUATzuuojY\nt5tl50bED/voOE9HxAf7Yl/SQDK8NSx19Uu7cyhk5kGZOb+H/UyOiIyIkf1U6mC7Crg4M8dm5s86\nL6xe+ytV2K6IiC9FxIhmD1od76lm9yNtrwxvaQgbAm8K3gE80sM6h2XmWOAY4FTgvH6vShrmDG+p\nG/Wj84iYFhELI+KliFgVEV+qVltQfX+hGn1Oj4gdIuLPImJZRKyOiJsiYlzdfs+ulq2NiP/W6Tjt\nEXFHRNwcES8B51bH/lFEvBARKyPiKxHxlrr9ZURcFBFLIuLliPhcROxXbfNSRNxev36n19hlrREx\nOiLWASOA/x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fLLLwfglVde4YQTTuCwww7j4IMPZu7cuUBt\n1NtxO+yvf/3rHHDAARxzzDHcf//9m/Z37rnncscdd2x6PnbsWADWrVvHzJkzOfzwwznkkEO46667\ntqht5cqVHH300bS2tnLwwQfzr//6rw29pvnz53PiiScC0N7eznnnnceMGTPYd999Nwv1m2++mWnT\nptHa2soFF1ywKZAvvPBC2traOOiggzb1AdRu/33FFVfwG7/xG3zrW99qqJZG9DhtnpkLImJyV8ui\ndsb9d4Hf7LOKJElD1saNG5k3bx6zZs0C4J577mHJkiX8+Mc/JjM56aSTWLBgAWvWrGGvvfbiu9/9\nLgAvvvjiZvtZuXIll19+OYsWLWLcuHF84AMfYOrUqVs99pgxY7jzzjvZeeedee655zjyyCM56aST\nNrv465vf/CbHHXccn/3sZ9m4cSOvvvpqr17n448/zn333cfLL7/Mu971Li688EKWLl3K3Llzuf/+\n+xk1ahQXXXQRt9xyC2effTZf+MIX2HXXXdm4cSMzZ87koYce4tBDD91U9w9/+MNe1dGdZs95HwWs\nyswldW1TIuJnwEvAn2VmY297JElD1muvvUZraytPP/00733vezn22GOBWnjfc889m4J33bp1LFmy\nhKOOOopLL72UT33qU5x44okcddRRm+3vwQcfZMaMGbS01D5A69RTT+UXv/jFVmvITD7zmc+wYMEC\ndthhB1asWMGqVavYc889N61zxBFHcN5557F+/XpOOeUUWltbe/V6TzjhBEaPHs3o0aMZP348q1at\nYt68eSxatIgjjjhiU5+MHz8egNtvv505c+awYcMGVq5cyaOPPropvE899dRe1bA1zV5tfjpwa93z\nlcCkzJwKXAJ8MyJ27mrDiJgdEQsjYuGaNWuaLEOS1J86znkvW7aMN954Y9M578zksssuY/HixSxe\nvJilS5cya9YsDjjgABYtWsQhhxzCZZddxhVXXLHFPrv7c6mRI0fy5ptvbtr/G2+8AcAtt9zCmjVr\nWLRoEYsXL2aPPfbY4m+ljz76aBYsWMDee+/NWWedxU033dSr1zt69OhNj0eMGMGGDRvITM4555xN\nr/WJJ56gvb2dX/7yl1x11VXM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
       "<matplotlib.figure.Figure at 0x15b4de48>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#在训练集上观察预测残差的分布，看是否符合模型假设：噪声为0均值的高斯噪声\n",
    "f, ax = plt.subplots(figsize=(7, 6)) \n",
    "f.tight_layout() \n",
    "ax.hist(y_train - reg_train_predict,bins=40, label='Residuals Linear', color='b', alpha=.5); \n",
    "ax.set_title(\"Histogram of Residuals\") \n",
    "ax.legend(loc='best');"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#在验证集上观察预测残差的分布，看是否符合模型假设：噪声为0均值的高斯噪声"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAekAAAG0CAYAAAAW3t++AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3X2UXXV97/H3l2RIlEB4mkAgYsKT\n8jzBIZJSHjQ+UIOA69qFXsCwiMQL2mtrsYr2lhG1rQWh5UJdTQUBQQmmKlwtt9BImsJFaKJpBIIm\nRVIT0iSgPARE8vC9f5w9cZLMZE5mzpn5Zeb9WuusOWef3977e35nZj7nt/ee30RmIkmSyrPbYBcg\nSZK6Z0hLklQoQ1qSpEIZ0pIkFcqQliSpUIa0JEmFMqQ17EXE4xFxxmDXMZgi4n0R8YuIWB8Rkwdw\nv+sj4tAenrsoIh5s0H6ejoh3NGJb0kAypDWkdffLedtf/pl5TGbO72U7EyMiI2Jkk0odbNcAH8vM\nMZn5422frF77y1WoroqIayNiRH93Wu3vqf5uRxqqDGmpAAWE/xuBx3tpc0JmjgFOB84DLm56VdIw\nZ0hr2Os62o6IKRGxMCJejIg1EXFt1WxB9fX5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VqlVbHl999dWcdNJJHH/88Vx55ZUAvPzyy0yfPp0TTjiBY489ljlz5gC1UWznFNBf\n+9rXOPLIIzn99NN56KGHtmzvoosuYu7cuVsejxkzBoD169czbdo0TjzxRI477jjuvvvu7WpbvXo1\np512Gm1tbRx77LH867/+a12vaf78+Zx11lkAdHR0cPHFF3PGGWdw6KGHbhXet99+O1OmTKGtrY2P\nfOQjW4L30ksvpb29nWOOOWZLH0BtyuurrrqK3/3d3+Vb3/pWXbXUy8PdkqStbNq0iXnz5jFz5kwA\n7rvvPpYtW8ajjz5KZnL22WezYMEC1q1bx0EHHcT3v/99AF544YWttrN69WquvPJKFi1axNixY3nb\n297G5MmTd7jv0aNH853vfIe99tqLZ599lpNPPpmzzz57qwuwvvGNb/Dud7+bz372s2zatIlXXnml\nT6/zySef5IEHHuCll17iTW96E5deeinLly9nzpw5PPTQQ7S0tHDZZZdxxx138KEPfYgvfvGL7Lvv\nvmzatIlp06axZMkSjj/++C11P/jgg32qY0cMaUkSAL/+9a9pa2vj6aef5i1veQvvfOc7gVpI33ff\nfVsCdv369SxbtoxTTz2Vyy+/nE996lOcddZZnHrqqVtt75FHHuGMM86gtbX2z57OO+88fvazn+2w\nhszkM5/5DAsWLGC33XZj1apVrFmzhgMPPHBLm5NOOomLL76YDRs2cO6559LW1tan1zt9+nRGjRrF\nqFGjGDduHGvWrGHevHksWrSIk046aUufjBs3DoC77rqL2bNns3HjRlavXs0TTzyxJaTPO++8PtXQ\nGw93S5KA356TXrFiBa+99tqWc9KZyRVXXMHixYtZvHgxy5cvZ+bMmRx55JEsWrSI4447jiuuuIKr\nrrpqu2329CdII0eOZPPmzVu2/9prrwFwxx13sG7dOhYtWsTixYs54IADtvs749NOO40FCxZw8MEH\nc+GFF3Lbbbf16fWOGjVqy/0RI0awceNGMpMZM2Zsea0//elP6ejo4Oc//znXXHMN8+bNY8mSJUyf\nPn2ruvbYY48+1dAbQ1qStJWxY8dy/fXXc80117Bhwwbe/e53c/PNN2+5snrVq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YKF28em3\ngOXAo8Chg11zIf3yz9QuxO383rhnsGse7D7Zpu18ale/N6UWpwWVJKlQu8LhbkmShiVDWpKkQhnS\nkiQVypCWJKlQhrQkSYUypCVJKpQhLUlSof4/jzHBdxx87kcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x107185f8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "reg_validate_predict=reg.predict(X_validate)\n",
    "f, ax = plt.subplots(figsize=(7, 6)) \n",
    "f.tight_layout() \n",
    "ax.hist(y_validate - reg_validate_predict,bins=40, label='Residuals Linear', color='b', alpha=.5); \n",
    "ax.set_title(\"Histogram of Residuals\") \n",
    "ax.legend(loc='best');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0.5,1,u'Distribution of validate')"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEICAYAAABfz4NwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3X2UXXV97/H3Z4YJnYgOD4leQCbB\n3lyvSgR0it5661NaTAIIpGrFiKnQlfrUQmsX2qZtpDat4qrG2qs2IkLpiKAmIkIqNNXS9oo1oYQJ\noga9CQYoAYIRJDXJ5Hv/2PsMJ2f2Pmefp5lzznxea83KnN/Ze5/fngP7u/fv4ftTRGBmZtY33RUw\nM7PO4IBgZmaAA4KZmaUcEMzMDHBAMDOzlAOCmZkBDgjWRpI+LelPWnSsYUlPSupPX39T0m+14tjp\n8TZKWtGq49XxuX8u6VFJ/9ni414t6c/T339F0veLbGszmwOCNUTSDkn7J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P1x6gozMwNmVpOR\nmZlV4YBgZmaAA4KZmaUcEMzMDHBAMDOzlAOCmZkBDghmZpb6/8l6ddZN621ZAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10a35eb8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(y_validate,reg_validate_predict,color = 'purple')\n",
    "plt.title(\"Distribution of validate\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "残差分布和高斯分布比较匹配"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.2.2 计算 test集上的价格"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('the predict of test_data is ', array([ 112408.11996886,  163854.21419708,  189703.18698007, ...,\n",
      "        170399.81395709,  116033.67541815,  233240.409346  ]))\n"
     ]
    }
   ],
   "source": [
    "print(\"the predict of test_data is \",np.exp(reg.predict(test_data)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.3 L1正则 lasso回归"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LassoCV(alphas=[0.0001, 0.001, 0.01, 0.1, 1, 10, 100], copy_X=True, cv=None,\n",
       "    eps=0.001, fit_intercept=True, max_iter=1000, n_alphas=100, n_jobs=1,\n",
       "    normalize=False, positive=False, precompute='auto', random_state=None,\n",
       "    selection='cyclic', tol=0.0001, verbose=False)"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#### Lasso／L1正则\n",
    "# class sklearn.linear_model.LassoCV(eps=0.001, n_alphas=100, alphas=None, fit_intercept=True, \n",
    "#                                    normalize=False, precompute=’auto’, max_iter=1000, \n",
    "#                                    tol=0.0001, copy_X=True, cv=None, verbose=False, n_jobs=1,\n",
    "#                                    positive=False, random_state=None, selection=’cyclic’)\n",
    "from sklearn.linear_model import LassoCV\n",
    "\n",
    "alphas = [0.0001,0.001,0.01, 0.1, 1, 10,100]\n",
    "\n",
    "lasso = LassoCV(alphas=alphas)   \n",
    "lasso.fit(X_train, y_train)   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3XmYVfWd5/H3h9rYQXZlCSi4gBBN\nEGNconEDTUt3Wls00x0z6Wamu32mOzNZdOyYRDM9STtJehLtJPTETnc2Y4xJ6K4yuCXGJCaCG0WB\nSIkLJbeAAgSKpdbv/HEvcimruBeoU7fq3s/reXg4y+/c+z1PLZ8633sWRQRmZmZHMqjQBZiZWf/n\nsDAzs5wcFmZmlpPDwszMcnJYmJlZTg4LMzPLyWFhZmY5OSzMzCwnh4WZmeVUXugCesu4ceNi+vTp\nhS7DzGxAeeaZZ5oiYnyucUUTFtOnT2fVqlWFLsPMbECR9Fo+49yGMjOznBwWZmaWk8PCzMxycliY\nmVlODgszM8sp0bCQtFDSekn1km7pZv1Fkp6V1C7p2i7rpkl6WNI6SWslTU+yVjMz61liYSGpDLgH\nWATMBm6QNLvLsNeBm4Dvd/MS/wbcFRFnAAuArUnVamZmR5bkdRYLgPqI2Agg6T5gMbD24ICIeDWz\nrjN7w0yolEfEI5lxzQnWWTweyhy8LfpCYesws6KTZFhMBjZlzTcA5+a57anAm5IeBGYAjwK3RERH\n9iBJS4GlANOmTTvugge8xtpCV2BFrLW9k3t+Uc/uA22FLsW6mDx6CH9+4cmJvke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o8L+A/JNVI\nujaz2YeAn2W9xtclrcqM/VwP79Ms6UuSnpX0mKTxWauvk/S0pJckXZgZP13Sk5nxz0p6b9b4n2Zq\nMEuUw8LskA8CZwHvBC4D7pJ0Ymb5dGAu8Oekr8A+6Hzgmaz52yJiPjAPeJ+ked28zzDg2Yh4F/AE\nh9+3qzwiFgB/m7V8K3B5Zvz1wFezxq8CLjz6XTU7Or43lNkhFwA/iIgOYIukJ4BzMst/FBGdQKOk\nX2RtcyKwLWv+TyQtJf2zdSLpBwWt7vI+nRy61fp3geybvx2cfoZ0QAFUAHdLOgvoAE7NGr8VGLBP\nQrSBw2FhdkhPDzI50gNO9gODATI32fs4cE5E7JT07YPrcsi+505L5v8ODv18fgzYQvqIZxBwIGv8\n4EwNZolyG8rskF8B10sqy3yOcBHwNPBr4I8zn11MBC7O2mYdMDMzPRLYC+zKjFvUw/sMAg5+5nFj\n5vWPZBSQyhzZ/ClQlrXuVNKPazVLlI8szA75CenPI14g/df+JyOiUdKPgUtJ/1J+ifSTyHZltqkm\nHR6PZp6y+BxQB2wEftPD++wF5kh6JvM61+eo65+AH0u6DvhFZvuDLsnUYJYo33XWLA+ShkdEs6Sx\npI82zs8EyRDSv8DPz3zWkc9rNUfE8F6q61fA4ojY2RuvZ9YTH1mY5ec/JI0GKoE7Dz5BMSL2S/oM\n6WdUv96XBWVaZV92UFhf8JGFmZnl5A+4zcwsJ4eFmZnl5LAwM7OcHBZmZpaTw8LMzHJyWJiZWU7/\nH8WoZgvycdsCAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10f8e710>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('alpha is:', 0.001)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([  4.81673037e-03,   1.89591299e-02,   1.11116233e-02,\n",
       "        -2.27781111e-04,  -1.71584744e-03,  -0.00000000e+00,\n",
       "         3.05458452e-03,   0.00000000e+00,   9.63399649e-03,\n",
       "         5.51819823e-02,   1.49498832e-02,   8.02949786e-03,\n",
       "         0.00000000e+00,  -4.03431891e-03,  -0.00000000e+00,\n",
       "        -7.02476020e-05,   1.58784462e-02,  -0.00000000e+00,\n",
       "         2.43412247e-02,  -1.62995588e-03,   6.60493344e-04,\n",
       "        -9.15449833e-03,   0.00000000e+00,   1.20414658e-02,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,   9.63685305e-03,  -7.98054727e-03,\n",
       "        -1.83674375e-02,   3.32844590e-03,   5.90975432e-03,\n",
       "         3.11225868e-02,   1.84258874e-08,   9.58026038e-03,\n",
       "         0.00000000e+00,   1.62484657e-03,   0.00000000e+00,\n",
       "         7.50956116e-03,   0.00000000e+00,   4.12982116e-03,\n",
       "         1.31692353e-02,   5.24509801e-03,   0.00000000e+00,\n",
       "        -1.43267339e-03,   8.17062906e-03,   0.00000000e+00,\n",
       "        -0.00000000e+00,   1.33631656e-03,   3.63337985e-04,\n",
       "         4.92018874e-02,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   9.47343890e-03,   1.84190405e-02,\n",
       "         2.73588599e-03,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   7.56823169e-03,  -0.00000000e+00,\n",
       "         1.48069213e-02,   0.00000000e+00,   1.07850703e-02,\n",
       "         9.34807714e-02,   0.00000000e+00,   0.00000000e+00,\n",
       "         1.81569146e-02,   0.00000000e+00,   4.35986961e-03,\n",
       "         4.71681845e-02,   0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,   1.17790338e-02,   0.00000000e+00,\n",
       "         9.99189923e-03,   0.00000000e+00,   2.46335439e-04,\n",
       "        -0.00000000e+00,   0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,  -0.00000000e+00,\n",
       "         1.85918819e-02,   8.46933290e-03,   0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,  -0.00000000e+00,\n",
       "         1.18535501e-02,   1.70080809e-02,   0.00000000e+00,\n",
       "        -0.00000000e+00,  -0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,  -5.25082496e-02,   0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,  -0.00000000e+00,\n",
       "         4.14134074e-02,  -0.00000000e+00,  -0.00000000e+00,\n",
       "        -0.00000000e+00,   0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,   0.00000000e+00,\n",
       "        -0.00000000e+00,   0.00000000e+00,  -0.00000000e+00,\n",
       "        -0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,   0.00000000e+00,\n",
       "        -2.67452134e-03,   0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,   3.99157931e-02,\n",
       "        -0.00000000e+00,   0.00000000e+00,  -7.63894701e-03,\n",
       "         0.00000000e+00,   8.97448258e-03,  -0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "        -8.65184681e-03,   0.00000000e+00,   0.00000000e+00,\n",
       "        -0.00000000e+00,   0.00000000e+00,  -0.00000000e+00,\n",
       "        -0.00000000e+00,  -0.00000000e+00,   0.00000000e+00,\n",
       "        -5.61109966e-04,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "        -0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "        -0.00000000e+00,  -0.00000000e+00,  -0.00000000e+00,\n",
       "         1.70504758e-03,   0.00000000e+00,  -0.00000000e+00,\n",
       "        -0.00000000e+00,   2.66547118e-02,   0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,   0.00000000e+00,\n",
       "         6.35934722e-03,  -0.00000000e+00,  -0.00000000e+00,\n",
       "        -0.00000000e+00,   0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,   0.00000000e+00,\n",
       "        -0.00000000e+00,  -0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         1.37583777e-02,  -0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   2.02109968e-02,\n",
       "        -0.00000000e+00,  -0.00000000e+00,  -2.22685728e-03,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "        -1.89728836e-02,  -0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,  -1.21062688e-02,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,  -0.00000000e+00,\n",
       "         1.27200694e-02,  -0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,   0.00000000e+00,\n",
       "        -1.93484824e-01,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,  -4.79329000e-02,   0.00000000e+00,\n",
       "        -0.00000000e+00,  -0.00000000e+00,   0.00000000e+00,\n",
       "         1.94982279e-02,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,  -0.00000000e+00,\n",
       "        -0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "        -3.94653194e-03,   2.75765043e-03,  -0.00000000e+00,\n",
       "        -0.00000000e+00,  -0.00000000e+00,   0.00000000e+00,\n",
       "        -0.00000000e+00,   0.00000000e+00,  -0.00000000e+00,\n",
       "         4.13220405e-02,   0.00000000e+00,  -0.00000000e+00,\n",
       "         9.49999933e-02,  -1.64811669e-02,  -0.00000000e+00,\n",
       "        -0.00000000e+00,  -3.43762277e-02,  -0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,   6.53041415e-02,  -0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,  -0.00000000e+00,\n",
       "         2.59369635e-02,   4.73909678e-02,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "        -0.00000000e+00,  -0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,  -0.00000000e+00,\n",
       "        -0.00000000e+00,   1.27778058e-02,  -0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,  -6.12121968e-02,\n",
       "         0.00000000e+00,  -0.00000000e+00,  -0.00000000e+00,\n",
       "         7.60135536e-05,   0.00000000e+00,   0.00000000e+00,\n",
       "        -0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,  -0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,  -0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,\n",
       "         0.00000000e+00])"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mses = np.mean(lasso.mse_path_, axis = 1)\n",
    "plt.plot(np.log10(lasso.alphas_), mses) \n",
    "plt.plot(np.log10(lasso.alpha_)*np.ones(3), [0.01, 0.01, 0.16])\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()    \n",
    "            \n",
    "print ('alpha is:', lasso.alpha_)\n",
    "lasso.coef_  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.3.1 模型评估"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "lasso_train_predict = lasso.predict(X_train)\n",
    "lasso_validate_predict = lasso.predict(X_validate)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The value of default measurement of Lasso Regression on train is 0.929226183507\n",
      "The value of default measurement of Lasso Regression on validate is 0.902355982333\n",
      "The value of MRSE   on train is 0.106058156325\n",
      "The value of MRSE   on validate is 0.120251572838\n"
     ]
    }
   ],
   "source": [
    "# 使用模型自带的评估模块（r2_score），并输出评估结果\n",
    "print 'The value of default measurement of Lasso Regression on train is', lasso.score(X_train, y_train)\n",
    "print 'The value of default measurement of Lasso Regression on validate is', lasso.score(X_validate, y_validate)\n",
    "#MRSE\n",
    "print 'The value of MRSE   on train is', np.sqrt(mean_squared_error(lasso_train_predict, y_train))\n",
    "print 'The value of MRSE   on validate is', np.sqrt(mean_squared_error(lasso_validate_predict, y_validate))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAe8AAAG0CAYAAAAbwK/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5f3ba/ojat/yLwY2pvBLrS6e94269Yao7I7GzWT9JAqEa7\nL1CbEu8suCRpK468pQEWER+ppoB3pXYHs4eBf2tuVZJKYnhLA282tQvFngH2ozY96xSYpB5z2lyS\npMI48pYkqTDN/tIDAMaNG5eTJ09udhmSJDXVokWLns3Mlu7aDYrwnjx5MgsXLmx2GZIkNVVE9OgO\ngk6bS5JUGMNbkqTCGN6SJBVmUJzzliR1bt26dbS3t/Pqq96pdUcycuRIJk2axIgRI3r1fMNbkgax\n9vZ2dtttNyZPnkxEX32ZnJopM3nuuedob29nypQpvdqH0+aSNIi9+uqrjB071uDegUQEY8eObWg2\nxfCWpEHO4N7xNPo7NbwlSSqM57wlqSBtbQO/v2HDhnHwwQezfv16pkyZwne+8x3GjBmz3cf6xCc+\nwXnnnccBBxyw2frrrruOhQsX8q1vfWu79wkwatQo1q5d26O2Rx11FJdeeimtra2b1i1cuJAbbriB\nyy67rFfHb4ZuR94RcU1ErImIR7ZY/+mIeDwilkTE39StvyAillfbjumPoiVJA+fNb34zixcv5pFH\nHmHPPffk8ssv79V+rrrqqq2CezBobW3t9+DesGFDn+6vJ9Pm1wHH1q+IiPdR+1rDQzLzQGrfSUxE\nHACcCBxYPefbETGsLwuWJDXPzJkzWbly5ablSy65hMMOO4xDDjmECy+8EICXX36Z4447jkMPPZSD\nDjqIW265BaiNejfeCvvaa69l//3358gjj+See+7ZtL/TTz+defPmbVoeNWoUAGvXrmXWrFlMnz6d\ngw8+mNtuu22r2latWsURRxzB1KlTOeigg/jFL37Ro9e0YMECPvzhDwPQ1tbGGWecwVFHHcW+++67\nWajfeOONzJgxg6lTp/LJT35yUyCfffbZtLa2cuCBB27qA6jd+vuiiy7iD//wD/n+97/fo1p6qttp\n88y8OyImb7H6bOArmfm7qs2aav1s4OZq/ZMRsRyYAdzbZxVLkppiw4YNzJ8/n7lz5wJwxx13sGzZ\nMh544AEyk+OPP567776bjo4O9t57b3784x8D8OKLL262n1WrVnHhhReyaNEiRo8ezfve9z6mTZu2\nzWOPHDmSH/7wh+y+++48++yzHH744Rx//PGbXfj13e9+l2OOOYYvfvGLbNiwgVdeeaVXr/Oxxx7j\nrrvu4je/+Q3veMc7OPvss1m+fDm33HIL99xzDyNGjOCcc87hpptu4rTTTuPiiy9mzz33ZMOGDcya\nNYuHHnqIQw45ZFPdv/zlL3tVx7b09oK1/YH3RsT9EfHziDisWj8ReLquXXu1bisRcVZELIyIhR0d\nHb0sQ5LU3377298ydepUxo4dy/PPP88HPvABoBbed9xxB9OmTWP69Ok89thjLFu2jIMPPpif/vSn\nfO5zn+MXv/gFo0eP3mx/999/P0cddRQtLS3stNNOfPzjH++2hszkC1/4AocccghHH300K1euZPXq\n1Zu1Oeyww7j22mtpa2vj4YcfZrfdduvV6z3uuOPYeeedGTduHOPHj2f16tXMnz+fRYsWcdhhhzF1\n6lTmz5/PE088AcCtt97K9OnTmTZtGkuWLOHRRx/dtK+evLbe6G14Dwf2AA4HPgPcGrW3P51d+56d\n7SAzr8zM1sxsbWnp9tvPJElNsvGc94oVK3jttdc2nfPOTC644AIWL17M4sWLWb58OXPnzmX//fdn\n0aJFHHzwwVxwwQVcdNFFW+2zq49KDR8+nNdff33T/l977TUAbrrpJjo6Oli0aBGLFy9mr7322upz\n0kcccQR33303EydO5NRTT+WGG27o1evdeeedNz0eNmwY69evJzOZM2fOptf6+OOP09bWxpNPPsml\nl17K/PnzeeihhzjuuOM2q2vXXXftVQ3d6W14twM/yJoHgNeBcdX6feraTQKeaaxESdJgMHr0aC67\n7DIuvfRS1q1bxzHHHMM111yz6UrvlStXsmbNGp555hl22WUXTjnlFM4//3wefPDBzfbz7ne/mwUL\nFvDcc8+xbt26zc4HT548mUWLFgFw2223sW7dOqA29T5+/HhGjBjBXXfdxYoVW39z5ooVKxg/fjxn\nnnkmc+fO3eq4jZg1axbz5s1jzZraWeLnn3+eFStW8NJLL7HrrrsyevRoVq9ezU9+8pM+O+a29Paj\nYj8C3g8siIj9gZ2AZ4Hbge9GxNeAv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mEMb0mSCmN4S5JUGMNbkqTCGN6SJBXG8JYkqTD/Hw6RNp9Z\nzmAsAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1073d2b0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#在训练集上观察预测残差的分布，看是否符合模型假设：噪声为0均值的高斯噪声\n",
    "f, ax = plt.subplots(figsize=(7, 6)) \n",
    "f.tight_layout() \n",
    "ax.hist(y_train - lasso_train_predict,bins=40, label='Residuals Linear', color='b', alpha=.5); \n",
    "ax.set_title(\"Histogram of Residuals\") \n",
    "ax.legend(loc='best');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAekAAAG0CAYAAAAW3t++AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAHY5JREFUeJzt3XuUXWWZoPHnJSkSJRAEEghETRBQ\n7gkWmDRy0YjQHQR6Db3Q4RIWAVygPXY7eEF72hK1WxsaWwbaJaMICDbBjAqjw2roSIwwXKxIGoGo\niUg0ISZFlEtAJAnv/HF2YiWpy0nVqTpfcp7fWll1Lvvs89VXlXpq733OrshMJElSeXZq9gAkSVLP\njLQkSYUy0pIkFcpIS5JUKCMtSVKhjLQkSYUy0mp5EfF4RJzY7HE0U0T8ZUT8JiLWRsTUYXzetRGx\nfy/3nR8R9zXoeZ6KiHc1Yl3ScDLS2qH19MN5yx/+mXloZs7vZz2TIiIjYuQQDbXZrgI+mJljMvOR\nLe+sPvcXq6iuiIirI2LEYJ+0er4nB7seaUdlpKUCFBD/NwKP97PMkZk5BjgBOAu4YMhHJbU4I62W\n131rOyKOiYjOiHg+IlZFxNXVYguqj89WW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N\nXZ+RliRtZfr06axYsWLT9SuvvJKjjz6aI444gk996lMAvPjii8ycOZMjjzySww47jDlz5gC1rdiN\np4D++te/zkEHHcQJJ5zA/fffv2l9559/PnPnzt10fcyYMQCsXbuWGTNmcNRRR3H44Ydzxx13bDW2\nlStXcvzxxzNlyhQOO+wwfvSjH9X1Oc2fP59TTz0VgI6ODi644AJOPPFE9t9//83ifcstt3DMMccw\nZcoU3v/+928K7yWXXEJ7ezuHHnropjmA2imvr7jiCt7+9rfzrW99q66x1Mvd3ZKkzWzYsIF58+Yx\ne/ZsAO6++26WLFnCww8/TGZy2mmnsWDBArq6uth33335/ve/D8Bzzz232XpWrlzJpz71KRYuXMjY\nsWN5xzvewdSpU/t87tGjR/Od73yH3XbbjWeeeYZp06Zx2mmnbfYirG9+85ucfPLJfPKTn2TDhg28\n9NJLA/o8f/azn3Hvvffywgsv8OY3v5lLLrmEpUuXMmfOHO6//37a2tq49NJLufXWWznvvPP43Oc+\nxx577MGGDRuYMWMGjz76KEccccSmcd93330DGkdfjLQkCYA//OEPTJkyhaeeeoq3vvWtnHTSSUAt\n0nffffemwK5du5YlS5Zw3HHHcdlll/Gxj32MU089leOOO26z9T300EOceOKJjBtX+4NPZ511Fr/4\nxS/6HENm8olPfIIFCxaw0047sWLFClatWsU+++yzaZmjjz6aCy64gHXr1nHGGWcwZcqUAX2+M2fO\nZNSoUYwaNYrx48ezatUq5s2bx8KFCzn66KM3zcn48eMBuP3227n++utZv349K1eu5IknntgU6bPO\nOmtAY+iPu7slScCfjkkvW7aMV155ZdMx6czk8ssvZ9GiRSxatIilS5cye/ZsDjroIBYuXMjhhx/O\n5ZdfzhVXXLHVOnt7G9LIkSN59dVXN63/lVdeAeDWW2+lq6uLhQsXsmjRIvbee++t3mt8/PHHs2DB\nAvbbbz/OPfdcbr755gF9vqNGjdp0ecSIEaxfv57MZNasWZs+15///Od0dHTwq1/9iquuuop58+bx\n6KOPMnPmzM3GtcsuuwxoDP0x0pKkzYwdO5Zrr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gufkP\nai/W3fh9cmezx1zS/Gyx7Hxqr4Tvd72eFlSSpEJtL7u7JUlqOUZakqRCGWlJkgplpCVJKpSRliSp\nUEZakqRCGWlJkgr1/wEa/K5lyR1sfAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x126e5080>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#在验证集上观察预测残差的分布，看是否符合模型假设：噪声为0均值的高斯噪声\n",
    "lasso_validate_predict=lasso.predict(X_validate)\n",
    "f, ax = plt.subplots(figsize=(7, 6)) \n",
    "f.tight_layout() \n",
    "ax.hist(y_validate - lasso_validate_predict,bins=40, label='Residuals Linear', color='b', alpha=.5); \n",
    "ax.set_title(\"Histogram of Residuals\") \n",
    "ax.legend(loc='best');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0.5,1,u'Distribution of validate')"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEICAYAAABfz4NwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3X+cXXV95/HXO2Giww8HSFIXkCTY\nzbIiEdQp7datv9JqEgjWtFppxFToZv1BS6x9+KOxDWjTVXyoobVC05JCNaK1JiCSVOi03bS72jog\nYVDEIE0wgiQkGFBmSTL57B/33OHOnXPuPffX3B/zfj4e85i5555z7vfkwvmc76/PVxGBmZnZjHYX\nwMzMOoMDgpmZAQ4IZmaWcEAwMzPAAcHMzBIOCGZmBjggWAtJul7SHzbpXPMk/UTSzOT1P0v67Wac\nOznfdkmrmnW+Gj73jyU9LulHT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9pd/jqu7UXA2cA/A4MZx80Evg+8EJgF7ATO\naff1NOPakv12A3PafQ01XNfrgOOSvz+W9t9jF39nVa+t07+zCtf2vJK/fxe4PuW4U4GHkt+nJH+f\n0u7ryfPTkzWESEnXDbyBQppt6OJ022nXFg2kIm9RMevSwLV1tIzruiOezfb7DQr5vMp163eW59o6\nXsa1PVny8gTSk3K+HrgzIg5GxBPAnUxeT6Yj9WRAyPD8iHgUIPn9Mxn7PTdJt/0NSV0ZNDJkpSLv\nFQHcIekuSavbXZgaXQZsT9neC99Z1rVBl35nktZL+gGwEvijlF269nubTgEhr3lRmIr+m8AGST/b\n7gI1Se6U413qFRHxMgqr871b0ivbXaA8JK0FjgKb095O2dY131mVa4Mu/c4iYm1EnEnhuq5I2aVr\nv7fpFBAek3QaQPJ7X9pOEfFI8vshCu3WL52qArZYVirynlDyve0DtlJobuloSWfjRcDKSBqfy3Tt\nd5bj2rryOyvzeeDXUrZ37fc2nQLCVyik2YaMdNuSTpH0nOTvOcArgO9MWQlbKzUVeZvL1BSSTpB0\nUvFvCp2a91U+qr0kLQHeD1wcEU9n7NaV31mea+vG7wxA0sKSlxcD303Z7WvA65L7ySkUru1rU1G+\nhrW7V7sVP8DNwKPAEQrR+nIKy3YOAbuS36cm+w5SSNcN8IvACIXRHCPA5e2+lpzX9sbk72copCf/\nWrLv6cC2kmOXAd+jMHJlbbuvpVnXRmEUzs7k59uddm0Z1/UghXbme5Kf63voO6t6bZ3+nVW4ti9T\nCFz3ArcBZyT7jt9HkteXJf8ODwJvb/e15P1x6gozMwOmV5ORmZlV4IBgZmaAA4KZmSUcEMzMDHBA\nMDOzhAOCmZkBDghmZpb4/x2Yn72bjU38AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1094b7f0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(y_validate,lasso_validate_predict,color = 'purple')\n",
    "plt.title(\"Distribution of validate\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.3.2 计算在 test集上的房价"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 113420.47260937  157206.72719881  190691.79920834 ...,  175135.98556115\n",
      "  118474.3683532   240957.6145065 ]\n"
     ]
    }
   ],
   "source": [
    "print(np.exp(lasso.predict(test_data)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 4 模型对比"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "通过对比 最小二乘 l2正则 l1正则的 r2 score 、MRSE发现 L2正则的r2 score分数最大，可以认为拟合效果最好。保存L2预测值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "reg_test_predict=reg.predict(test_data)\n",
    "result = pd.DataFrame(np.exp(reg_test_predict),index = test_id , columns = [\"SalePrice\"])\n",
    "result.to_csv('L2Ridge_predict.csv',header=True,index_label = 'Id')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
